package com.an.producer;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Service;


/**
 * mq生产者
 *
 * @author: Ann
 * @createDate: 2024/04/09
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class MqProducer {

    private final AmqpTemplate amqpTemplate;


    /**
     * 发送消息
     *
     * @param exchange   交换
     * @param routingKey 路由关键
     * @param message    消息
     * @author: Ann
     * @createDate: 2024/04/09
     */
    public void sendMessage(String exchange, String routingKey, Object message){
        amqpTemplate.convertAndSend(exchange,routingKey,message);
    }


}
